#include "WeaponBonus.h"
#include "SoundEngine.h"

WeaponBonus::WeaponBonus (const Point3d &pos, const RGBd &col,  Weapon *weapon, double strengthInc, double rechargeInc) 
: Bonus(pos,col), strengthInc(strengthInc), rechargeInc(rechargeInc)
{
	this->weapon = weapon;
}

void
WeaponBonus::applyBonus (Player *p)
{
	p->takenPowerUp();
	SoundEngine::getInstance()->play("PowerUp");
	if (this->weapon != NULL)
		p->setWeapon(this->weapon);
	else {
		Weapon *w = p->getWeapon();
		w->modifyStrength(strengthInc);
		w->modifyRechargeTime(rechargeInc);
	}
	this->alive() = false;
}
